import axios from '@/utils/request'
const base = '/userserver'

export function saveOrgUnit(data) {
  return axios({
    url: `${base}/orgUnits`,
    method: 'post',
    data
  })
}

export function listOrgUnit(params) {
  return axios({
    url: `${base}/orgUnits`,
    method: 'get',
    params: params
  })
}

export function deleteOrgUnit(id) {
  return axios({
    url: `${base}/orgUnits/` + id,
    method: 'delete'
  })
}

export function modifyOrgUnit(id, data) {
  return axios({
    url: `${base}/orgUnits/` + id,
    method: 'put',
    data
  })
}

export function myOrgUnit() {
  return axios({
    url: `${base}/orgUnits/mine`,
    method: 'get'
  })
}

export function currentOrgUnit(orgUnitId) {
  return axios({
    url: `${base}/orgUnits/current/` + orgUnitId,
    method: 'put'
  })
}

export function online(id) {
  return axios({
    url: `${base}/orgUnits/` + id + '/online',
    method: 'put'
  })
}

export function offline(id) {
  return axios({
    url: `${base}/orgUnits/` + id + '/offline',
    method: 'put'
  })
}

